# include "inputmanager.h"
# include "WEWindow.h"

using WuguiEngine::WEWindow;

namespace WuguiEngine
{
	namespace Input
	{
		InputManager* InputManager::instance = NULL;
		InputManager* InputManager::GetInstance()
		{
			if (instance == NULL)
			{
				instance = new InputManager(WEWindow::GetInstance()->GetHWnd());
			}

			return instance;
		}

		InputManager::InputManager(HWND _hWnd)
		{
			hWnd = _hWnd;
			pMouseProcessor = new MouseProcessor();
			pKeyboardProcessor = new KeyboardProcessor();
		}

		void InputManager::Dispose()
		{
			delete pMouseProcessor;
			delete pKeyboardProcessor;
		}

		void InputManager::Update(DWORD dt)
		{
			//pMouseProcessor->Update(dt);
			pKeyboardProcessor->Update(dt);
		}

		bool InputManager::IsKeyDown(int i)
		{
			return pKeyboardProcessor->IsKeyDown(i);
		}

		bool InputManager::IsKeyPressed(int i)
		{
			return pKeyboardProcessor->IsKeyPressed(i);
		}
	}
}

